
_kill:     file format elf32-i386


Disassembly of section .text:

00000000 <main>:
#include "stat.h"
#include "user.h"

int
main(int argc, char **argv)
{
   0:	55                   	push   %ebp
   1:	89 e5                	mov    %esp,%ebp
   3:	57                   	push   %edi
   4:	56                   	push   %esi
   5:	53                   	push   %ebx
   6:	83 e4 f0             	and    $0xfffffff0,%esp
   9:	83 ec 10             	sub    $0x10,%esp
   c:	8b 75 08             	mov    0x8(%ebp),%esi
   f:	8b 7d 0c             	mov    0xc(%ebp),%edi
  int i;

  if(argc < 1){
  12:	85 f6                	test   %esi,%esi
  14:	7e 29                	jle    3f <main+0x3f>
    printf(2, "usage: kill pid...\n");
    exit();
  }
  for(i=1; i<argc; i++)
  16:	83 fe 01             	cmp    $0x1,%esi
  19:	bb 01 00 00 00       	mov    $0x1,%ebx
  1e:	74 1a                	je     3a <main+0x3a>
    kill(atoi(argv[i]));
  20:	8b 04 9f             	mov    (%edi,%ebx,4),%eax

  if(argc < 1){
    printf(2, "usage: kill pid...\n");
    exit();
  }
  for(i=1; i<argc; i++)
  23:	83 c3 01             	add    $0x1,%ebx
    kill(atoi(argv[i]));
  26:	89 04 24             	mov    %eax,(%esp)
  29:	e8 f2 01 00 00       	call   220 <atoi>
  2e:	89 04 24             	mov    %eax,(%esp)
  31:	e8 be 02 00 00       	call   2f4 <kill>

  if(argc < 1){
    printf(2, "usage: kill pid...\n");
    exit();
  }
  for(i=1; i<argc; i++)
  36:	39 f3                	cmp    %esi,%ebx
  38:	75 e6                	jne    20 <main+0x20>
    kill(atoi(argv[i]));
  exit();
  3a:	e8 85 02 00 00       	call   2c4 <exit>
main(int argc, char **argv)
{
  int i;

  if(argc < 1){
    printf(2, "usage: kill pid...\n");
  3f:	c7 44 24 04 d6 06 00 	movl   $0x6d6,0x4(%esp)
  46:	00 
  47:	c7 04 24 02 00 00 00 	movl   $0x2,(%esp)
  4e:	e8 bd 03 00 00       	call   410 <printf>
    exit();
  53:	e8 6c 02 00 00       	call   2c4 <exit>
  58:	90                   	nop
  59:	90                   	nop
  5a:	90                   	nop
  5b:	90                   	nop
  5c:	90                   	nop
  5d:	90                   	nop
  5e:	90                   	nop
  5f:	90                   	nop

00000060 <strcpy>:
#include "user.h"
#include "x86.h"

char*
strcpy(char *s, char *t)
{
  60:	53                   	push   %ebx
  61:	8b 44 24 08          	mov    0x8(%esp),%eax
  char *os;

  os = s;
  while((*s++ = *t++) != 0)
  65:	31 d2                	xor    %edx,%edx
#include "user.h"
#include "x86.h"

char*
strcpy(char *s, char *t)
{
  67:	8b 5c 24 0c          	mov    0xc(%esp),%ebx
  6b:	90                   	nop
  6c:	8d 74 26 00          	lea    0x0(%esi,%eiz,1),%esi
  char *os;

  os = s;
  while((*s++ = *t++) != 0)
  70:	0f b6 0c 13          	movzbl (%ebx,%edx,1),%ecx
  74:	88 0c 10             	mov    %cl,(%eax,%edx,1)
  77:	83 c2 01             	add    $0x1,%edx
  7a:	84 c9                	test   %cl,%cl
  7c:	75 f2                	jne    70 <strcpy+0x10>
    ;
  return os;
}
  7e:	5b                   	pop    %ebx
  7f:	c3                   	ret    

00000080 <strcmp>:

int
strcmp(const char *p, const char *q)
{
  80:	56                   	push   %esi
  81:	53                   	push   %ebx
  82:	8b 4c 24 0c          	mov    0xc(%esp),%ecx
  86:	8b 54 24 10          	mov    0x10(%esp),%edx
  while(*p && *p == *q)
  8a:	0f b6 01             	movzbl (%ecx),%eax
  8d:	0f b6 1a             	movzbl (%edx),%ebx
  90:	84 c0                	test   %al,%al
  92:	74 24                	je     b8 <strcmp+0x38>
  94:	38 d8                	cmp    %bl,%al
  96:	74 11                	je     a9 <strcmp+0x29>
  98:	eb 2e                	jmp    c8 <strcmp+0x48>
  9a:	8d b6 00 00 00 00    	lea    0x0(%esi),%esi
  a0:	83 c1 01             	add    $0x1,%ecx
  a3:	38 d8                	cmp    %bl,%al
  a5:	75 21                	jne    c8 <strcmp+0x48>
    p++, q++;
  a7:	89 f2                	mov    %esi,%edx
}

int
strcmp(const char *p, const char *q)
{
  while(*p && *p == *q)
  a9:	0f b6 41 01          	movzbl 0x1(%ecx),%eax
    p++, q++;
  ad:	8d 72 01             	lea    0x1(%edx),%esi
}

int
strcmp(const char *p, const char *q)
{
  while(*p && *p == *q)
  b0:	0f b6 5a 01          	movzbl 0x1(%edx),%ebx
  b4:	84 c0                	test   %al,%al
  b6:	75 e8                	jne    a0 <strcmp+0x20>
    p++, q++;
  return (uchar)*p - (uchar)*q;
  b8:	0f b6 db             	movzbl %bl,%ebx
}

int
strcmp(const char *p, const char *q)
{
  while(*p && *p == *q)
  bb:	31 c0                	xor    %eax,%eax
    p++, q++;
  return (uchar)*p - (uchar)*q;
  bd:	29 d8                	sub    %ebx,%eax
}
  bf:	5b                   	pop    %ebx
  c0:	5e                   	pop    %esi
  c1:	c3                   	ret    
  c2:	8d b6 00 00 00 00    	lea    0x0(%esi),%esi
int
strcmp(const char *p, const char *q)
{
  while(*p && *p == *q)
    p++, q++;
  return (uchar)*p - (uchar)*q;
  c8:	0f b6 db             	movzbl %bl,%ebx
}

int
strcmp(const char *p, const char *q)
{
  while(*p && *p == *q)
  cb:	0f b6 c0             	movzbl %al,%eax
    p++, q++;
  return (uchar)*p - (uchar)*q;
  ce:	29 d8                	sub    %ebx,%eax
}
  d0:	5b                   	pop    %ebx
  d1:	5e                   	pop    %esi
  d2:	c3                   	ret    
  d3:	8d b6 00 00 00 00    	lea    0x0(%esi),%esi
  d9:	8d bc 27 00 00 00 00 	lea    0x0(%edi,%eiz,1),%edi

000000e0 <strlen>:

uint
strlen(char *s)
{
  e0:	8b 4c 24 04          	mov    0x4(%esp),%ecx
  int n;

  for(n = 0; s[n]; n++)
  e4:	31 c0                	xor    %eax,%eax
  e6:	80 39 00             	cmpb   $0x0,(%ecx)
  e9:	74 10                	je     fb <strlen+0x1b>
  eb:	31 d2                	xor    %edx,%edx
  ed:	8d 76 00             	lea    0x0(%esi),%esi
  f0:	83 c2 01             	add    $0x1,%edx
  f3:	80 3c 11 00          	cmpb   $0x0,(%ecx,%edx,1)
  f7:	89 d0                	mov    %edx,%eax
  f9:	75 f5                	jne    f0 <strlen+0x10>
    ;
  return n;
}
  fb:	f3 c3                	repz ret 
  fd:	8d 76 00             	lea    0x0(%esi),%esi

00000100 <memset>:

void*
memset(void *dst, int c, uint n)
{
 100:	57                   	push   %edi
 101:	8b 54 24 08          	mov    0x8(%esp),%edx
}

static inline void
stosb(void *addr, int data, int cnt)
{
  asm volatile("cld; rep stosb" :
 105:	8b 4c 24 10          	mov    0x10(%esp),%ecx
 109:	8b 44 24 0c          	mov    0xc(%esp),%eax
 10d:	89 d7                	mov    %edx,%edi
 10f:	fc                   	cld    
 110:	f3 aa                	rep stos %al,%es:(%edi)
  stosb(dst, c, n);
  return dst;
}
 112:	89 d0                	mov    %edx,%eax
 114:	5f                   	pop    %edi
 115:	c3                   	ret    
 116:	8d 76 00             	lea    0x0(%esi),%esi
 119:	8d bc 27 00 00 00 00 	lea    0x0(%edi,%eiz,1),%edi

00000120 <strchr>:

char*
strchr(const char *s, char c)
{
 120:	8b 44 24 04          	mov    0x4(%esp),%eax
 124:	0f b6 4c 24 08       	movzbl 0x8(%esp),%ecx
  for(; *s; s++)
 129:	0f b6 10             	movzbl (%eax),%edx
 12c:	84 d2                	test   %dl,%dl
 12e:	74 1d                	je     14d <strchr+0x2d>
    if(*s == c)
 130:	38 ca                	cmp    %cl,%dl
 132:	75 0e                	jne    142 <strchr+0x22>
 134:	eb 1c                	jmp    152 <strchr+0x32>
 136:	66 90                	xchg   %ax,%ax
}

char*
strchr(const char *s, char c)
{
  for(; *s; s++)
 138:	83 c0 01             	add    $0x1,%eax
    if(*s == c)
 13b:	38 ca                	cmp    %cl,%dl
 13d:	8d 76 00             	lea    0x0(%esi),%esi
 140:	74 0e                	je     150 <strchr+0x30>
}

char*
strchr(const char *s, char c)
{
  for(; *s; s++)
 142:	0f b6 50 01          	movzbl 0x1(%eax),%edx
 146:	84 d2                	test   %dl,%dl
 148:	75 ee                	jne    138 <strchr+0x18>
    if(*s == c)
      return (char*) s;
  return 0;
 14a:	31 c0                	xor    %eax,%eax
 14c:	c3                   	ret    
 14d:	31 c0                	xor    %eax,%eax
 14f:	90                   	nop
}
 150:	f3 c3                	repz ret 
 152:	f3 c3                	repz ret 
 154:	8d b6 00 00 00 00    	lea    0x0(%esi),%esi
 15a:	8d bf 00 00 00 00    	lea    0x0(%edi),%edi

00000160 <gets>:

char*
gets(char *buf, int max)
{
 160:	55                   	push   %ebp
 161:	57                   	push   %edi
 162:	56                   	push   %esi
  int i, cc;
  char c;

  for(i=0; i+1 < max; ){
 163:	31 f6                	xor    %esi,%esi
  return 0;
}

char*
gets(char *buf, int max)
{
 165:	53                   	push   %ebx
 166:	83 ec 2c             	sub    $0x2c,%esp
 169:	8b 7c 24 40          	mov    0x40(%esp),%edi
 16d:	8b 6c 24 44          	mov    0x44(%esp),%ebp
  int i, cc;
  char c;

  for(i=0; i+1 < max; ){
 171:	eb 38                	jmp    1ab <gets+0x4b>
 173:	90                   	nop
 174:	8d 74 26 00          	lea    0x0(%esi,%eiz,1),%esi
    cc = read(0, &c, 1);
 178:	8d 44 24 1f          	lea    0x1f(%esp),%eax
 17c:	c7 44 24 08 01 00 00 	movl   $0x1,0x8(%esp)
 183:	00 
 184:	89 44 24 04          	mov    %eax,0x4(%esp)
 188:	c7 04 24 00 00 00 00 	movl   $0x0,(%esp)
 18f:	e8 48 01 00 00       	call   2dc <read>
    if(cc < 1)
 194:	85 c0                	test   %eax,%eax
 196:	7e 1a                	jle    1b2 <gets+0x52>
      break;
    buf[i++] = c;
 198:	0f b6 44 24 1f       	movzbl 0x1f(%esp),%eax
gets(char *buf, int max)
{
  int i, cc;
  char c;

  for(i=0; i+1 < max; ){
 19d:	89 de                	mov    %ebx,%esi
    cc = read(0, &c, 1);
    if(cc < 1)
      break;
    buf[i++] = c;
    if(c == '\n' || c == '\r')
 19f:	3c 0d                	cmp    $0xd,%al

  for(i=0; i+1 < max; ){
    cc = read(0, &c, 1);
    if(cc < 1)
      break;
    buf[i++] = c;
 1a1:	88 44 1f ff          	mov    %al,-0x1(%edi,%ebx,1)
    if(c == '\n' || c == '\r')
 1a5:	74 0b                	je     1b2 <gets+0x52>
 1a7:	3c 0a                	cmp    $0xa,%al
 1a9:	74 07                	je     1b2 <gets+0x52>
gets(char *buf, int max)
{
  int i, cc;
  char c;

  for(i=0; i+1 < max; ){
 1ab:	8d 5e 01             	lea    0x1(%esi),%ebx
 1ae:	39 eb                	cmp    %ebp,%ebx
 1b0:	7c c6                	jl     178 <gets+0x18>
      break;
    buf[i++] = c;
    if(c == '\n' || c == '\r')
      break;
  }
  buf[i] = '\0';
 1b2:	c6 04 37 00          	movb   $0x0,(%edi,%esi,1)
  return buf;
}
 1b6:	83 c4 2c             	add    $0x2c,%esp
 1b9:	89 f8                	mov    %edi,%eax
 1bb:	5b                   	pop    %ebx
 1bc:	5e                   	pop    %esi
 1bd:	5f                   	pop    %edi
 1be:	5d                   	pop    %ebp
 1bf:	c3                   	ret    

000001c0 <stat>:

int
stat(char *n, struct statt *st)
{
 1c0:	83 ec 1c             	sub    $0x1c,%esp
  int fd;
  int r;

  fd = open(n, O_RDONLY);
 1c3:	8b 44 24 20          	mov    0x20(%esp),%eax
  return buf;
}

int
stat(char *n, struct statt *st)
{
 1c7:	89 5c 24 14          	mov    %ebx,0x14(%esp)
 1cb:	89 74 24 18          	mov    %esi,0x18(%esp)
  int fd;
  int r;

  fd = open(n, O_RDONLY);
  if(fd < 0)
    return -1;
 1cf:	be ff ff ff ff       	mov    $0xffffffff,%esi
stat(char *n, struct statt *st)
{
  int fd;
  int r;

  fd = open(n, O_RDONLY);
 1d4:	c7 44 24 04 00 00 00 	movl   $0x0,0x4(%esp)
 1db:	00 
 1dc:	89 04 24             	mov    %eax,(%esp)
 1df:	e8 20 01 00 00       	call   304 <open>
  if(fd < 0)
 1e4:	85 c0                	test   %eax,%eax
stat(char *n, struct statt *st)
{
  int fd;
  int r;

  fd = open(n, O_RDONLY);
 1e6:	89 c3                	mov    %eax,%ebx
  if(fd < 0)
 1e8:	78 1a                	js     204 <stat+0x44>
    return -1;
  r = fstat(fd, st);
 1ea:	8b 44 24 24          	mov    0x24(%esp),%eax
 1ee:	89 1c 24             	mov    %ebx,(%esp)
 1f1:	89 44 24 04          	mov    %eax,0x4(%esp)
 1f5:	e8 22 01 00 00       	call   31c <fstat>
  close(fd);
 1fa:	89 1c 24             	mov    %ebx,(%esp)
  int r;

  fd = open(n, O_RDONLY);
  if(fd < 0)
    return -1;
  r = fstat(fd, st);
 1fd:	89 c6                	mov    %eax,%esi
  close(fd);
 1ff:	e8 e8 00 00 00       	call   2ec <close>
  return r;
}
 204:	89 f0                	mov    %esi,%eax
 206:	8b 5c 24 14          	mov    0x14(%esp),%ebx
 20a:	8b 74 24 18          	mov    0x18(%esp),%esi
 20e:	83 c4 1c             	add    $0x1c,%esp
 211:	c3                   	ret    
 212:	8d b4 26 00 00 00 00 	lea    0x0(%esi,%eiz,1),%esi
 219:	8d bc 27 00 00 00 00 	lea    0x0(%edi,%eiz,1),%edi

00000220 <atoi>:

int
atoi(const char *s)
{
 220:	53                   	push   %ebx
 221:	8b 4c 24 08          	mov    0x8(%esp),%ecx
  int n;

  n = 0;
 225:	31 c0                	xor    %eax,%eax
  while('0' <= *s && *s <= '9')
 227:	0f b6 11             	movzbl (%ecx),%edx
 22a:	8d 5a d0             	lea    -0x30(%edx),%ebx
 22d:	80 fb 09             	cmp    $0x9,%bl
 230:	77 1e                	ja     250 <atoi+0x30>
 232:	8d b6 00 00 00 00    	lea    0x0(%esi),%esi
    n = n*10 + *s++ - '0';
 238:	0f be d2             	movsbl %dl,%edx
 23b:	83 c1 01             	add    $0x1,%ecx
 23e:	8d 04 80             	lea    (%eax,%eax,4),%eax
 241:	8d 44 42 d0          	lea    -0x30(%edx,%eax,2),%eax
atoi(const char *s)
{
  int n;

  n = 0;
  while('0' <= *s && *s <= '9')
 245:	0f b6 11             	movzbl (%ecx),%edx
 248:	8d 5a d0             	lea    -0x30(%edx),%ebx
 24b:	80 fb 09             	cmp    $0x9,%bl
 24e:	76 e8                	jbe    238 <atoi+0x18>
    n = n*10 + *s++ - '0';
  return n;
}
 250:	5b                   	pop    %ebx
 251:	c3                   	ret    
 252:	8d b4 26 00 00 00 00 	lea    0x0(%esi,%eiz,1),%esi
 259:	8d bc 27 00 00 00 00 	lea    0x0(%edi,%eiz,1),%edi

00000260 <memmove>:

void*
memmove(void *vdst, void *vsrc, int n)
{
 260:	56                   	push   %esi
 261:	53                   	push   %ebx
 262:	8b 5c 24 14          	mov    0x14(%esp),%ebx
 266:	8b 44 24 0c          	mov    0xc(%esp),%eax
 26a:	8b 74 24 10          	mov    0x10(%esp),%esi
  char *dst, *src;
  
  dst = vdst;
  src = vsrc;
  while(n-- > 0)
 26e:	85 db                	test   %ebx,%ebx
 270:	7e 14                	jle    286 <memmove+0x26>
    n = n*10 + *s++ - '0';
  return n;
}

void*
memmove(void *vdst, void *vsrc, int n)
 272:	31 d2                	xor    %edx,%edx
 274:	8d 74 26 00          	lea    0x0(%esi,%eiz,1),%esi
  char *dst, *src;
  
  dst = vdst;
  src = vsrc;
  while(n-- > 0)
    *dst++ = *src++;
 278:	0f b6 0c 16          	movzbl (%esi,%edx,1),%ecx
 27c:	88 0c 10             	mov    %cl,(%eax,%edx,1)
 27f:	83 c2 01             	add    $0x1,%edx
{
  char *dst, *src;
  
  dst = vdst;
  src = vsrc;
  while(n-- > 0)
 282:	39 da                	cmp    %ebx,%edx
 284:	75 f2                	jne    278 <memmove+0x18>
    *dst++ = *src++;
  return vdst;
}
 286:	5b                   	pop    %ebx
 287:	5e                   	pop    %esi
 288:	c3                   	ret    
 289:	8d b4 26 00 00 00 00 	lea    0x0(%esi,%eiz,1),%esi

00000290 <memcpy>:

void *
memcpy(void *dst, const void *src, uint n)
{
 290:	56                   	push   %esi
 291:	53                   	push   %ebx
 292:	8b 5c 24 14          	mov    0x14(%esp),%ebx
 296:	8b 44 24 0c          	mov    0xc(%esp),%eax
 29a:	8b 74 24 10          	mov    0x10(%esp),%esi
{
  char *dst, *src;
  
  dst = vdst;
  src = vsrc;
  while(n-- > 0)
 29e:	85 db                	test   %ebx,%ebx
 2a0:	7e 14                	jle    2b6 <memcpy+0x26>
 2a2:	31 d2                	xor    %edx,%edx
 2a4:	8d 74 26 00          	lea    0x0(%esi,%eiz,1),%esi
    *dst++ = *src++;
 2a8:	0f b6 0c 16          	movzbl (%esi,%edx,1),%ecx
 2ac:	88 0c 10             	mov    %cl,(%eax,%edx,1)
 2af:	83 c2 01             	add    $0x1,%edx
{
  char *dst, *src;
  
  dst = vdst;
  src = vsrc;
  while(n-- > 0)
 2b2:	39 da                	cmp    %ebx,%edx
 2b4:	75 f2                	jne    2a8 <memcpy+0x18>

void *
memcpy(void *dst, const void *src, uint n)
{
  return memmove(dst, src, n);
}
 2b6:	5b                   	pop    %ebx
 2b7:	5e                   	pop    %esi
 2b8:	c3                   	ret    
 2b9:	90                   	nop
 2ba:	90                   	nop
 2bb:	90                   	nop

000002bc <fork>:
 2bc:	b8 01 00 00 00       	mov    $0x1,%eax
 2c1:	cd 40                	int    $0x40
 2c3:	c3                   	ret    

000002c4 <exit>:
 2c4:	b8 02 00 00 00       	mov    $0x2,%eax
 2c9:	cd 40                	int    $0x40
 2cb:	c3                   	ret    

000002cc <wait>:
 2cc:	b8 03 00 00 00       	mov    $0x3,%eax
 2d1:	cd 40                	int    $0x40
 2d3:	c3                   	ret    

000002d4 <pipe>:
 2d4:	b8 04 00 00 00       	mov    $0x4,%eax
 2d9:	cd 40                	int    $0x40
 2db:	c3                   	ret    

000002dc <read>:
 2dc:	b8 06 00 00 00       	mov    $0x6,%eax
 2e1:	cd 40                	int    $0x40
 2e3:	c3                   	ret    

000002e4 <write>:
 2e4:	b8 05 00 00 00       	mov    $0x5,%eax
 2e9:	cd 40                	int    $0x40
 2eb:	c3                   	ret    

000002ec <close>:
 2ec:	b8 07 00 00 00       	mov    $0x7,%eax
 2f1:	cd 40                	int    $0x40
 2f3:	c3                   	ret    

000002f4 <kill>:
 2f4:	b8 08 00 00 00       	mov    $0x8,%eax
 2f9:	cd 40                	int    $0x40
 2fb:	c3                   	ret    

000002fc <exec>:
 2fc:	b8 09 00 00 00       	mov    $0x9,%eax
 301:	cd 40                	int    $0x40
 303:	c3                   	ret    

00000304 <open>:
 304:	b8 0a 00 00 00       	mov    $0xa,%eax
 309:	cd 40                	int    $0x40
 30b:	c3                   	ret    

0000030c <mknod>:
 30c:	b8 0b 00 00 00       	mov    $0xb,%eax
 311:	cd 40                	int    $0x40
 313:	c3                   	ret    

00000314 <unlink>:
 314:	b8 0c 00 00 00       	mov    $0xc,%eax
 319:	cd 40                	int    $0x40
 31b:	c3                   	ret    

0000031c <fstat>:
 31c:	b8 0d 00 00 00       	mov    $0xd,%eax
 321:	cd 40                	int    $0x40
 323:	c3                   	ret    

00000324 <link>:
 324:	b8 0e 00 00 00       	mov    $0xe,%eax
 329:	cd 40                	int    $0x40
 32b:	c3                   	ret    

0000032c <mkdir>:
 32c:	b8 0f 00 00 00       	mov    $0xf,%eax
 331:	cd 40                	int    $0x40
 333:	c3                   	ret    

00000334 <chdir>:
 334:	b8 10 00 00 00       	mov    $0x10,%eax
 339:	cd 40                	int    $0x40
 33b:	c3                   	ret    

0000033c <dup>:
 33c:	b8 11 00 00 00       	mov    $0x11,%eax
 341:	cd 40                	int    $0x40
 343:	c3                   	ret    

00000344 <getpid>:
 344:	b8 12 00 00 00       	mov    $0x12,%eax
 349:	cd 40                	int    $0x40
 34b:	c3                   	ret    

0000034c <sbrk>:
 34c:	b8 13 00 00 00       	mov    $0x13,%eax
 351:	cd 40                	int    $0x40
 353:	c3                   	ret    

00000354 <sleep>:
 354:	b8 14 00 00 00       	mov    $0x14,%eax
 359:	cd 40                	int    $0x40
 35b:	c3                   	ret    
 35c:	90                   	nop
 35d:	90                   	nop
 35e:	90                   	nop
 35f:	90                   	nop

00000360 <putc>:
#include "stat.h"
#include "user.h"

static void
putc(int fd, char c)
{
 360:	83 ec 2c             	sub    $0x2c,%esp
 363:	88 54 24 1c          	mov    %dl,0x1c(%esp)
  write(fd, &c, 1);
 367:	8d 54 24 1c          	lea    0x1c(%esp),%edx
 36b:	c7 44 24 08 01 00 00 	movl   $0x1,0x8(%esp)
 372:	00 
 373:	89 54 24 04          	mov    %edx,0x4(%esp)
 377:	89 04 24             	mov    %eax,(%esp)
 37a:	e8 65 ff ff ff       	call   2e4 <write>
}
 37f:	83 c4 2c             	add    $0x2c,%esp
 382:	c3                   	ret    
 383:	8d b6 00 00 00 00    	lea    0x0(%esi),%esi
 389:	8d bc 27 00 00 00 00 	lea    0x0(%edi,%eiz,1),%edi

00000390 <printint>:

static void
printint(int fd, int xx, int base, int sgn)
{
 390:	57                   	push   %edi
 391:	56                   	push   %esi
 392:	53                   	push   %ebx
 393:	89 c3                	mov    %eax,%ebx
 395:	83 ec 10             	sub    $0x10,%esp
  char buf[16];
  int i, neg;
  uint x;

  neg = 0;
  if(sgn && xx < 0){
 398:	8b 44 24 20          	mov    0x20(%esp),%eax
 39c:	85 c0                	test   %eax,%eax
 39e:	74 60                	je     400 <printint+0x70>
 3a0:	89 d0                	mov    %edx,%eax
 3a2:	c1 e8 1f             	shr    $0x1f,%eax
 3a5:	84 c0                	test   %al,%al
 3a7:	74 57                	je     400 <printint+0x70>
    neg = 1;
    x = -xx;
 3a9:	89 d0                	mov    %edx,%eax
  int i, neg;
  uint x;

  neg = 0;
  if(sgn && xx < 0){
    neg = 1;
 3ab:	bf 01 00 00 00       	mov    $0x1,%edi
    x = -xx;
 3b0:	f7 d8                	neg    %eax
  } else {
    x = xx;
  }

  i = 0;
 3b2:	31 f6                	xor    %esi,%esi
 3b4:	eb 04                	jmp    3ba <printint+0x2a>
 3b6:	66 90                	xchg   %ax,%ax
  do{
    buf[i++] = digits[x % base];
 3b8:	89 d6                	mov    %edx,%esi
 3ba:	31 d2                	xor    %edx,%edx
 3bc:	f7 f1                	div    %ecx
 3be:	0f b6 92 f1 06 00 00 	movzbl 0x6f1(%edx),%edx
  }while((x /= base) != 0);
 3c5:	85 c0                	test   %eax,%eax
    x = xx;
  }

  i = 0;
  do{
    buf[i++] = digits[x % base];
 3c7:	88 14 34             	mov    %dl,(%esp,%esi,1)
 3ca:	8d 56 01             	lea    0x1(%esi),%edx
  }while((x /= base) != 0);
 3cd:	75 e9                	jne    3b8 <printint+0x28>
  if(neg)
 3cf:	85 ff                	test   %edi,%edi
 3d1:	74 07                	je     3da <printint+0x4a>
    buf[i++] = '-';
 3d3:	c6 04 14 2d          	movb   $0x2d,(%esp,%edx,1)
 3d7:	8d 56 02             	lea    0x2(%esi),%edx

  while(--i >= 0)
 3da:	8d 72 ff             	lea    -0x1(%edx),%esi
 3dd:	8d 76 00             	lea    0x0(%esi),%esi
    putc(fd, buf[i]);
 3e0:	0f be 14 34          	movsbl (%esp,%esi,1),%edx
 3e4:	89 d8                	mov    %ebx,%eax
    buf[i++] = digits[x % base];
  }while((x /= base) != 0);
  if(neg)
    buf[i++] = '-';

  while(--i >= 0)
 3e6:	83 ee 01             	sub    $0x1,%esi
    putc(fd, buf[i]);
 3e9:	e8 72 ff ff ff       	call   360 <putc>
    buf[i++] = digits[x % base];
  }while((x /= base) != 0);
  if(neg)
    buf[i++] = '-';

  while(--i >= 0)
 3ee:	83 fe ff             	cmp    $0xffffffff,%esi
 3f1:	75 ed                	jne    3e0 <printint+0x50>
    putc(fd, buf[i]);
}
 3f3:	83 c4 10             	add    $0x10,%esp
 3f6:	5b                   	pop    %ebx
 3f7:	5e                   	pop    %esi
 3f8:	5f                   	pop    %edi
 3f9:	c3                   	ret    
 3fa:	8d b6 00 00 00 00    	lea    0x0(%esi),%esi
  neg = 0;
  if(sgn && xx < 0){
    neg = 1;
    x = -xx;
  } else {
    x = xx;
 400:	89 d0                	mov    %edx,%eax
  static char digits[] = "0123456789ABCDEF";
  char buf[16];
  int i, neg;
  uint x;

  neg = 0;
 402:	31 ff                	xor    %edi,%edi
 404:	eb ac                	jmp    3b2 <printint+0x22>
 406:	8d 76 00             	lea    0x0(%esi),%esi
 409:	8d bc 27 00 00 00 00 	lea    0x0(%edi,%eiz,1),%edi

00000410 <printf>:
}

// Print to the given fd. Only understands %d, %x, %p, %s.
void
printf(int fd, char *fmt, ...)
{
 410:	55                   	push   %ebp
 411:	57                   	push   %edi
 412:	56                   	push   %esi
 413:	53                   	push   %ebx
 414:	83 ec 2c             	sub    $0x2c,%esp
  int c, i, state;
  uint *ap;

  state = 0;
  ap = (uint*)(void*)&fmt + 1;
  for(i = 0; fmt[i]; i++){
 417:	8b 5c 24 44          	mov    0x44(%esp),%ebx
}

// Print to the given fd. Only understands %d, %x, %p, %s.
void
printf(int fd, char *fmt, ...)
{
 41b:	8b 6c 24 40          	mov    0x40(%esp),%ebp
  int c, i, state;
  uint *ap;

  state = 0;
  ap = (uint*)(void*)&fmt + 1;
  for(i = 0; fmt[i]; i++){
 41f:	0f b6 0b             	movzbl (%ebx),%ecx
 422:	84 c9                	test   %cl,%cl
 424:	0f 84 86 00 00 00    	je     4b0 <printf+0xa0>
  char *s;
  int c, i, state;
  uint *ap;

  state = 0;
  ap = (uint*)(void*)&fmt + 1;
 42a:	8d 44 24 48          	lea    0x48(%esp),%eax
{
  char *s;
  int c, i, state;
  uint *ap;

  state = 0;
 42e:	31 f6                	xor    %esi,%esi
  ap = (uint*)(void*)&fmt + 1;
 430:	89 44 24 1c          	mov    %eax,0x1c(%esp)
 434:	eb 1b                	jmp    451 <printf+0x41>
 436:	66 90                	xchg   %ax,%ax
  for(i = 0; fmt[i]; i++){
    c = fmt[i] & 0xff;
    if(state == 0){
      if(c == '%'){
 438:	83 f9 25             	cmp    $0x25,%ecx
 43b:	74 7b                	je     4b8 <printf+0xa8>
        state = '%';
      } else {
        putc(fd, c);
 43d:	0f be d1             	movsbl %cl,%edx
 440:	89 e8                	mov    %ebp,%eax
 442:	e8 19 ff ff ff       	call   360 <putc>
      } else if(c == '%'){
        putc(fd, c);
      } else {
        // Unknown % sequence.  Print it to draw attention.
        putc(fd, '%');
        putc(fd, c);
 447:	83 c3 01             	add    $0x1,%ebx
  int c, i, state;
  uint *ap;

  state = 0;
  ap = (uint*)(void*)&fmt + 1;
  for(i = 0; fmt[i]; i++){
 44a:	0f b6 0b             	movzbl (%ebx),%ecx
 44d:	84 c9                	test   %cl,%cl
 44f:	74 5f                	je     4b0 <printf+0xa0>
    c = fmt[i] & 0xff;
    if(state == 0){
 451:	85 f6                	test   %esi,%esi
  uint *ap;

  state = 0;
  ap = (uint*)(void*)&fmt + 1;
  for(i = 0; fmt[i]; i++){
    c = fmt[i] & 0xff;
 453:	0f b6 c9             	movzbl %cl,%ecx
    if(state == 0){
 456:	74 e0                	je     438 <printf+0x28>
      if(c == '%'){
        state = '%';
      } else {
        putc(fd, c);
      }
    } else if(state == '%'){
 458:	83 fe 25             	cmp    $0x25,%esi
 45b:	75 ea                	jne    447 <printf+0x37>
      if(c == 'd'){
 45d:	83 f9 64             	cmp    $0x64,%ecx
 460:	0f 84 ba 00 00 00    	je     520 <printf+0x110>
        printint(fd, *ap, 10, 1);
        ap++;
      } else if(c == 'x' || c == 'p'){
 466:	83 f9 70             	cmp    $0x70,%ecx
 469:	74 55                	je     4c0 <printf+0xb0>
 46b:	83 f9 78             	cmp    $0x78,%ecx
 46e:	66 90                	xchg   %ax,%ax
 470:	74 4e                	je     4c0 <printf+0xb0>
        printint(fd, *ap, 16, 0);
        ap++;
      } else if(c == 's'){
 472:	83 f9 73             	cmp    $0x73,%ecx
 475:	74 71                	je     4e8 <printf+0xd8>
          s = "(null)";
        while(*s != 0){
          putc(fd, *s);
          s++;
        }
      } else if(c == 'c'){
 477:	83 f9 63             	cmp    $0x63,%ecx
 47a:	0f 84 c3 00 00 00    	je     543 <printf+0x133>
        putc(fd, *ap);
        ap++;
      } else if(c == '%'){
 480:	83 f9 25             	cmp    $0x25,%ecx
        putc(fd, c);
 483:	ba 25 00 00 00       	mov    $0x25,%edx
 488:	89 e8                	mov    %ebp,%eax
          s++;
        }
      } else if(c == 'c'){
        putc(fd, *ap);
        ap++;
      } else if(c == '%'){
 48a:	74 12                	je     49e <printf+0x8e>
        putc(fd, c);
      } else {
        // Unknown % sequence.  Print it to draw attention.
        putc(fd, '%');
 48c:	89 4c 24 18          	mov    %ecx,0x18(%esp)
 490:	e8 cb fe ff ff       	call   360 <putc>
        putc(fd, c);
 495:	8b 4c 24 18          	mov    0x18(%esp),%ecx
 499:	89 e8                	mov    %ebp,%eax
 49b:	0f be d1             	movsbl %cl,%edx
 49e:	e8 bd fe ff ff       	call   360 <putc>
      }
      state = 0;
 4a3:	31 f6                	xor    %esi,%esi
      } else if(c == '%'){
        putc(fd, c);
      } else {
        // Unknown % sequence.  Print it to draw attention.
        putc(fd, '%');
        putc(fd, c);
 4a5:	83 c3 01             	add    $0x1,%ebx
  int c, i, state;
  uint *ap;

  state = 0;
  ap = (uint*)(void*)&fmt + 1;
  for(i = 0; fmt[i]; i++){
 4a8:	0f b6 0b             	movzbl (%ebx),%ecx
 4ab:	84 c9                	test   %cl,%cl
 4ad:	75 a2                	jne    451 <printf+0x41>
 4af:	90                   	nop
        putc(fd, c);
      }
      state = 0;
    }
  }
}
 4b0:	83 c4 2c             	add    $0x2c,%esp
 4b3:	5b                   	pop    %ebx
 4b4:	5e                   	pop    %esi
 4b5:	5f                   	pop    %edi
 4b6:	5d                   	pop    %ebp
 4b7:	c3                   	ret    
  ap = (uint*)(void*)&fmt + 1;
  for(i = 0; fmt[i]; i++){
    c = fmt[i] & 0xff;
    if(state == 0){
      if(c == '%'){
        state = '%';
 4b8:	be 25 00 00 00       	mov    $0x25,%esi
 4bd:	eb 88                	jmp    447 <printf+0x37>
 4bf:	90                   	nop
    } else if(state == '%'){
      if(c == 'd'){
        printint(fd, *ap, 10, 1);
        ap++;
      } else if(c == 'x' || c == 'p'){
        printint(fd, *ap, 16, 0);
 4c0:	8b 44 24 1c          	mov    0x1c(%esp),%eax
 4c4:	b9 10 00 00 00       	mov    $0x10,%ecx
      } else {
        // Unknown % sequence.  Print it to draw attention.
        putc(fd, '%');
        putc(fd, c);
      }
      state = 0;
 4c9:	31 f6                	xor    %esi,%esi
    } else if(state == '%'){
      if(c == 'd'){
        printint(fd, *ap, 10, 1);
        ap++;
      } else if(c == 'x' || c == 'p'){
        printint(fd, *ap, 16, 0);
 4cb:	c7 04 24 00 00 00 00 	movl   $0x0,(%esp)
 4d2:	8b 10                	mov    (%eax),%edx
 4d4:	89 e8                	mov    %ebp,%eax
 4d6:	e8 b5 fe ff ff       	call   390 <printint>
        ap++;
 4db:	83 44 24 1c 04       	addl   $0x4,0x1c(%esp)
 4e0:	e9 62 ff ff ff       	jmp    447 <printf+0x37>
 4e5:	8d 76 00             	lea    0x0(%esi),%esi
      } else if(c == 's'){
        s = (char*)*ap;
 4e8:	8b 44 24 1c          	mov    0x1c(%esp),%eax
 4ec:	8b 38                	mov    (%eax),%edi
        ap++;
 4ee:	83 c0 04             	add    $0x4,%eax
 4f1:	89 44 24 1c          	mov    %eax,0x1c(%esp)
        if(s == 0)
 4f5:	85 ff                	test   %edi,%edi
 4f7:	74 64                	je     55d <printf+0x14d>
          s = "(null)";
        while(*s != 0){
 4f9:	0f b6 17             	movzbl (%edi),%edx
      } else {
        // Unknown % sequence.  Print it to draw attention.
        putc(fd, '%');
        putc(fd, c);
      }
      state = 0;
 4fc:	31 f6                	xor    %esi,%esi
      } else if(c == 's'){
        s = (char*)*ap;
        ap++;
        if(s == 0)
          s = "(null)";
        while(*s != 0){
 4fe:	84 d2                	test   %dl,%dl
 500:	0f 84 41 ff ff ff    	je     447 <printf+0x37>
 506:	66 90                	xchg   %ax,%ax
          putc(fd, *s);
 508:	0f be d2             	movsbl %dl,%edx
          s++;
 50b:	83 c7 01             	add    $0x1,%edi
        s = (char*)*ap;
        ap++;
        if(s == 0)
          s = "(null)";
        while(*s != 0){
          putc(fd, *s);
 50e:	89 e8                	mov    %ebp,%eax
 510:	e8 4b fe ff ff       	call   360 <putc>
      } else if(c == 's'){
        s = (char*)*ap;
        ap++;
        if(s == 0)
          s = "(null)";
        while(*s != 0){
 515:	0f b6 17             	movzbl (%edi),%edx
 518:	84 d2                	test   %dl,%dl
 51a:	75 ec                	jne    508 <printf+0xf8>
      } else {
        // Unknown % sequence.  Print it to draw attention.
        putc(fd, '%');
        putc(fd, c);
      }
      state = 0;
 51c:	31 f6                	xor    %esi,%esi
 51e:	eb 85                	jmp    4a5 <printf+0x95>
      } else {
        putc(fd, c);
      }
    } else if(state == '%'){
      if(c == 'd'){
        printint(fd, *ap, 10, 1);
 520:	8b 44 24 1c          	mov    0x1c(%esp),%eax
 524:	b1 0a                	mov    $0xa,%cl
      } else {
        // Unknown % sequence.  Print it to draw attention.
        putc(fd, '%');
        putc(fd, c);
      }
      state = 0;
 526:	66 31 f6             	xor    %si,%si
      } else {
        putc(fd, c);
      }
    } else if(state == '%'){
      if(c == 'd'){
        printint(fd, *ap, 10, 1);
 529:	c7 04 24 01 00 00 00 	movl   $0x1,(%esp)
 530:	8b 10                	mov    (%eax),%edx
 532:	89 e8                	mov    %ebp,%eax
 534:	e8 57 fe ff ff       	call   390 <printint>
        ap++;
 539:	83 44 24 1c 04       	addl   $0x4,0x1c(%esp)
 53e:	e9 04 ff ff ff       	jmp    447 <printf+0x37>
        while(*s != 0){
          putc(fd, *s);
          s++;
        }
      } else if(c == 'c'){
        putc(fd, *ap);
 543:	8b 44 24 1c          	mov    0x1c(%esp),%eax
      } else {
        // Unknown % sequence.  Print it to draw attention.
        putc(fd, '%');
        putc(fd, c);
      }
      state = 0;
 547:	31 f6                	xor    %esi,%esi
        while(*s != 0){
          putc(fd, *s);
          s++;
        }
      } else if(c == 'c'){
        putc(fd, *ap);
 549:	0f be 10             	movsbl (%eax),%edx
 54c:	89 e8                	mov    %ebp,%eax
 54e:	e8 0d fe ff ff       	call   360 <putc>
        ap++;
 553:	83 44 24 1c 04       	addl   $0x4,0x1c(%esp)
 558:	e9 ea fe ff ff       	jmp    447 <printf+0x37>
        ap++;
      } else if(c == 's'){
        s = (char*)*ap;
        ap++;
        if(s == 0)
          s = "(null)";
 55d:	bf ea 06 00 00       	mov    $0x6ea,%edi
 562:	eb 95                	jmp    4f9 <printf+0xe9>
 564:	90                   	nop
 565:	90                   	nop
 566:	90                   	nop
 567:	90                   	nop
 568:	90                   	nop
 569:	90                   	nop
 56a:	90                   	nop
 56b:	90                   	nop
 56c:	90                   	nop
 56d:	90                   	nop
 56e:	90                   	nop
 56f:	90                   	nop

00000570 <free>:
static Header base;
static Header *freep;

void
free(void *ap)
{
 570:	57                   	push   %edi
  Header *bp, *p;

  bp = (Header*) ap - 1;
  for(p = freep; !(bp > p && bp < p->s.ptr); p = p->s.ptr)
 571:	a1 a0 09 00 00       	mov    0x9a0,%eax
static Header base;
static Header *freep;

void
free(void *ap)
{
 576:	56                   	push   %esi
 577:	53                   	push   %ebx
 578:	8b 5c 24 10          	mov    0x10(%esp),%ebx
  Header *bp, *p;

  bp = (Header*) ap - 1;
 57c:	8d 4b f8             	lea    -0x8(%ebx),%ecx
 57f:	90                   	nop
  for(p = freep; !(bp > p && bp < p->s.ptr); p = p->s.ptr)
 580:	39 c8                	cmp    %ecx,%eax
 582:	8b 10                	mov    (%eax),%edx
 584:	73 04                	jae    58a <free+0x1a>
 586:	39 d1                	cmp    %edx,%ecx
 588:	72 16                	jb     5a0 <free+0x30>
    if(p >= p->s.ptr && (bp > p || bp < p->s.ptr))
 58a:	39 d0                	cmp    %edx,%eax
 58c:	72 08                	jb     596 <free+0x26>
 58e:	39 c8                	cmp    %ecx,%eax
 590:	72 0e                	jb     5a0 <free+0x30>
 592:	39 d1                	cmp    %edx,%ecx
 594:	72 0a                	jb     5a0 <free+0x30>
static Header base;
static Header *freep;

void
free(void *ap)
{
 596:	89 d0                	mov    %edx,%eax
 598:	eb e6                	jmp    580 <free+0x10>
 59a:	8d b6 00 00 00 00    	lea    0x0(%esi),%esi

  bp = (Header*) ap - 1;
  for(p = freep; !(bp > p && bp < p->s.ptr); p = p->s.ptr)
    if(p >= p->s.ptr && (bp > p || bp < p->s.ptr))
      break;
  if(bp + bp->s.size == p->s.ptr){
 5a0:	8b 73 fc             	mov    -0x4(%ebx),%esi
 5a3:	8d 3c f1             	lea    (%ecx,%esi,8),%edi
 5a6:	39 d7                	cmp    %edx,%edi
 5a8:	74 18                	je     5c2 <free+0x52>
    bp->s.size += p->s.ptr->s.size;
    bp->s.ptr = p->s.ptr->s.ptr;
  } else
    bp->s.ptr = p->s.ptr;
 5aa:	89 53 f8             	mov    %edx,-0x8(%ebx)
  if(p + p->s.size == bp){
 5ad:	8b 50 04             	mov    0x4(%eax),%edx
 5b0:	8d 34 d0             	lea    (%eax,%edx,8),%esi
 5b3:	39 f1                	cmp    %esi,%ecx
 5b5:	74 22                	je     5d9 <free+0x69>
    p->s.size += bp->s.size;
    p->s.ptr = bp->s.ptr;
  } else
    p->s.ptr = bp;
 5b7:	89 08                	mov    %ecx,(%eax)
  freep = p;
 5b9:	a3 a0 09 00 00       	mov    %eax,0x9a0
}
 5be:	5b                   	pop    %ebx
 5bf:	5e                   	pop    %esi
 5c0:	5f                   	pop    %edi
 5c1:	c3                   	ret    
  bp = (Header*) ap - 1;
  for(p = freep; !(bp > p && bp < p->s.ptr); p = p->s.ptr)
    if(p >= p->s.ptr && (bp > p || bp < p->s.ptr))
      break;
  if(bp + bp->s.size == p->s.ptr){
    bp->s.size += p->s.ptr->s.size;
 5c2:	03 72 04             	add    0x4(%edx),%esi
 5c5:	89 73 fc             	mov    %esi,-0x4(%ebx)
    bp->s.ptr = p->s.ptr->s.ptr;
 5c8:	8b 10                	mov    (%eax),%edx
 5ca:	8b 12                	mov    (%edx),%edx
 5cc:	89 53 f8             	mov    %edx,-0x8(%ebx)
  } else
    bp->s.ptr = p->s.ptr;
  if(p + p->s.size == bp){
 5cf:	8b 50 04             	mov    0x4(%eax),%edx
 5d2:	8d 34 d0             	lea    (%eax,%edx,8),%esi
 5d5:	39 f1                	cmp    %esi,%ecx
 5d7:	75 de                	jne    5b7 <free+0x47>
    p->s.size += bp->s.size;
 5d9:	03 53 fc             	add    -0x4(%ebx),%edx
    p->s.ptr = bp->s.ptr;
  } else
    p->s.ptr = bp;
  freep = p;
 5dc:	a3 a0 09 00 00       	mov    %eax,0x9a0
    bp->s.size += p->s.ptr->s.size;
    bp->s.ptr = p->s.ptr->s.ptr;
  } else
    bp->s.ptr = p->s.ptr;
  if(p + p->s.size == bp){
    p->s.size += bp->s.size;
 5e1:	89 50 04             	mov    %edx,0x4(%eax)
    p->s.ptr = bp->s.ptr;
 5e4:	8b 53 f8             	mov    -0x8(%ebx),%edx
 5e7:	89 10                	mov    %edx,(%eax)
  } else
    p->s.ptr = bp;
  freep = p;
}
 5e9:	5b                   	pop    %ebx
 5ea:	5e                   	pop    %esi
 5eb:	5f                   	pop    %edi
 5ec:	c3                   	ret    
 5ed:	8d 76 00             	lea    0x0(%esi),%esi

000005f0 <malloc>:
  return freep;
}

void*
malloc(uint nbytes)
{
 5f0:	57                   	push   %edi
 5f1:	56                   	push   %esi
 5f2:	53                   	push   %ebx
 5f3:	83 ec 10             	sub    $0x10,%esp
  Header *p, *prevp;
  uint nunits;

  nunits = (nbytes + sizeof(Header) - 1)/sizeof(Header) + 1;
  if((prevp = freep) == 0){
 5f6:	8b 15 a0 09 00 00    	mov    0x9a0,%edx
malloc(uint nbytes)
{
  Header *p, *prevp;
  uint nunits;

  nunits = (nbytes + sizeof(Header) - 1)/sizeof(Header) + 1;
 5fc:	8b 5c 24 20          	mov    0x20(%esp),%ebx
 600:	83 c3 07             	add    $0x7,%ebx
 603:	c1 eb 03             	shr    $0x3,%ebx
 606:	83 c3 01             	add    $0x1,%ebx
  if((prevp = freep) == 0){
 609:	85 d2                	test   %edx,%edx
 60b:	0f 84 9d 00 00 00    	je     6ae <malloc+0xbe>
 611:	8b 02                	mov    (%edx),%eax
 613:	8b 48 04             	mov    0x4(%eax),%ecx
    base.s.ptr = freep = prevp = &base;
    base.s.size = 0;
  }
  for(p = prevp->s.ptr; ; prevp = p, p = p->s.ptr){
    if(p->s.size >= nunits){
 616:	39 d9                	cmp    %ebx,%ecx
 618:	73 6e                	jae    688 <malloc+0x98>
        p->s.size -= nunits;
        p += p->s.size;
        p->s.size = nunits;
      }
      freep = prevp;
      return (void*) (p + 1);
 61a:	8d 3c dd 00 00 00 00 	lea    0x0(,%ebx,8),%edi
 621:	eb 0e                	jmp    631 <malloc+0x41>
 623:	90                   	nop
 624:	8d 74 26 00          	lea    0x0(%esi,%eiz,1),%esi
  nunits = (nbytes + sizeof(Header) - 1)/sizeof(Header) + 1;
  if((prevp = freep) == 0){
    base.s.ptr = freep = prevp = &base;
    base.s.size = 0;
  }
  for(p = prevp->s.ptr; ; prevp = p, p = p->s.ptr){
 628:	8b 02                	mov    (%edx),%eax
    if(p->s.size >= nunits){
 62a:	8b 48 04             	mov    0x4(%eax),%ecx
 62d:	39 cb                	cmp    %ecx,%ebx
 62f:	76 57                	jbe    688 <malloc+0x98>
        p->s.size = nunits;
      }
      freep = prevp;
      return (void*) (p + 1);
    }
    if(p == freep)
 631:	3b 05 a0 09 00 00    	cmp    0x9a0,%eax
 637:	89 c2                	mov    %eax,%edx
 639:	75 ed                	jne    628 <malloc+0x38>
morecore(uint nu)
{
  char *p;
  Header *hp;

  if(nu < PAGE)
 63b:	81 fb ff 0f 00 00    	cmp    $0xfff,%ebx
 641:	b8 00 80 00 00       	mov    $0x8000,%eax
    nu = PAGE;
 646:	be 00 10 00 00       	mov    $0x1000,%esi
morecore(uint nu)
{
  char *p;
  Header *hp;

  if(nu < PAGE)
 64b:	76 04                	jbe    651 <malloc+0x61>
 64d:	89 f8                	mov    %edi,%eax
 64f:	89 de                	mov    %ebx,%esi
    nu = PAGE;
  p = sbrk(nu * sizeof(Header));
 651:	89 04 24             	mov    %eax,(%esp)
 654:	e8 f3 fc ff ff       	call   34c <sbrk>
  if(p == (char*) -1)
 659:	83 f8 ff             	cmp    $0xffffffff,%eax
 65c:	74 1a                	je     678 <malloc+0x88>
    return 0;
  hp = (Header*)p;
  hp->s.size = nu;
 65e:	89 70 04             	mov    %esi,0x4(%eax)
  free((void*)(hp + 1));
 661:	83 c0 08             	add    $0x8,%eax
 664:	89 04 24             	mov    %eax,(%esp)
 667:	e8 04 ff ff ff       	call   570 <free>
  return freep;
 66c:	8b 15 a0 09 00 00    	mov    0x9a0,%edx
      }
      freep = prevp;
      return (void*) (p + 1);
    }
    if(p == freep)
      if((p = morecore(nunits)) == 0)
 672:	85 d2                	test   %edx,%edx
 674:	75 b2                	jne    628 <malloc+0x38>
 676:	66 90                	xchg   %ax,%ax
        return 0;
  }
}
 678:	83 c4 10             	add    $0x10,%esp
      freep = prevp;
      return (void*) (p + 1);
    }
    if(p == freep)
      if((p = morecore(nunits)) == 0)
        return 0;
 67b:	31 c0                	xor    %eax,%eax
  }
}
 67d:	5b                   	pop    %ebx
 67e:	5e                   	pop    %esi
 67f:	5f                   	pop    %edi
 680:	c3                   	ret    
 681:	8d b4 26 00 00 00 00 	lea    0x0(%esi,%eiz,1),%esi
    base.s.ptr = freep = prevp = &base;
    base.s.size = 0;
  }
  for(p = prevp->s.ptr; ; prevp = p, p = p->s.ptr){
    if(p->s.size >= nunits){
      if(p->s.size == nunits)
 688:	39 cb                	cmp    %ecx,%ebx
 68a:	74 1c                	je     6a8 <malloc+0xb8>
        prevp->s.ptr = p->s.ptr;
      else {
        p->s.size -= nunits;
 68c:	29 d9                	sub    %ebx,%ecx
 68e:	89 48 04             	mov    %ecx,0x4(%eax)
        p += p->s.size;
 691:	8d 04 c8             	lea    (%eax,%ecx,8),%eax
        p->s.size = nunits;
 694:	89 58 04             	mov    %ebx,0x4(%eax)
      }
      freep = prevp;
 697:	89 15 a0 09 00 00    	mov    %edx,0x9a0
    }
    if(p == freep)
      if((p = morecore(nunits)) == 0)
        return 0;
  }
}
 69d:	83 c4 10             	add    $0x10,%esp
        p->s.size -= nunits;
        p += p->s.size;
        p->s.size = nunits;
      }
      freep = prevp;
      return (void*) (p + 1);
 6a0:	83 c0 08             	add    $0x8,%eax
    }
    if(p == freep)
      if((p = morecore(nunits)) == 0)
        return 0;
  }
}
 6a3:	5b                   	pop    %ebx
 6a4:	5e                   	pop    %esi
 6a5:	5f                   	pop    %edi
 6a6:	c3                   	ret    
 6a7:	90                   	nop
    base.s.size = 0;
  }
  for(p = prevp->s.ptr; ; prevp = p, p = p->s.ptr){
    if(p->s.size >= nunits){
      if(p->s.size == nunits)
        prevp->s.ptr = p->s.ptr;
 6a8:	8b 08                	mov    (%eax),%ecx
 6aa:	89 0a                	mov    %ecx,(%edx)
 6ac:	eb e9                	jmp    697 <malloc+0xa7>
  Header *p, *prevp;
  uint nunits;

  nunits = (nbytes + sizeof(Header) - 1)/sizeof(Header) + 1;
  if((prevp = freep) == 0){
    base.s.ptr = freep = prevp = &base;
 6ae:	c7 05 a0 09 00 00 a4 	movl   $0x9a4,0x9a0
 6b5:	09 00 00 
    base.s.size = 0;
 6b8:	b8 a4 09 00 00       	mov    $0x9a4,%eax
  Header *p, *prevp;
  uint nunits;

  nunits = (nbytes + sizeof(Header) - 1)/sizeof(Header) + 1;
  if((prevp = freep) == 0){
    base.s.ptr = freep = prevp = &base;
 6bd:	c7 05 a4 09 00 00 a4 	movl   $0x9a4,0x9a4
 6c4:	09 00 00 
    base.s.size = 0;
 6c7:	c7 05 a8 09 00 00 00 	movl   $0x0,0x9a8
 6ce:	00 00 00 
 6d1:	e9 44 ff ff ff       	jmp    61a <malloc+0x2a>
